<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr1 = [2,6,1,77,52,25,7,99];
        var max = arr1[0];
        for (i = 1;i < arr1.length;i++) {
            if (arr1[i] > max) {
                max = arr1[i];
            }
        }
        console.log('该数组中最大值为'+max+'');


        var arr2 = [2,6,1,77,52,25,7];
        var min = arr2[0];
        for (i = 1;i < arr2.length;i++) {
            if (arr2[i] < min) {
                min = arr2[i];
            }
        }
        console.log('该数组中最小值为'+min+'');
    </script>
</body>
</html>